<template>
  <div>

    <el-row>
      <el-col :span="4">&nbsp &nbsp</el-col>
      <el-col :span="13">

        <el-table :data="page.records" border>
          <el-table-column prop="enterId" label="申请ID" width="115">
          </el-table-column>
          <el-table-column prop="coachId" label="申请人" width="135">
          </el-table-column>
          <el-table-column prop="enterVenueId" label="入驻场馆" width="130">
          </el-table-column>
          <el-table-column prop="enterState" label="申请状态" width="130">
            <template slot-scope="scope">
              <template v-if="scope.row.enterState == 1">申请中</template>
              <template v-if="scope.row.enterState == 0">已驳回</template>
              <template v-if="scope.row.enterState == 2">已通过</template>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="申请时间" width="170">
          </el-table-column>

          <el-table-column label="操作" width="151">
            <template #default="scope">
              <el-button @click="passExamine(scope.row.coachId)" v-if="scope.row.enterState == '1'" type="text"
                size="small">通过</el-button>
              <el-button @click="openExamine(scope.row.coachId)" v-if="scope.row.enterState == '1'" type="text"
                size="small">打开简历</el-button>
            </template>
          </el-table-column>

        </el-table>

        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :current-page="page.pageNum" :page-sizes="[1, 2, 3, 5]" :page-size="page.pageSize"
          layout="total, sizes, prev, pager, next, jumper" :total="page.total">
        </el-pagination>

      </el-col>

      <el-col :span="5">&nbsp</el-col>


      <el-dialog title="简历信息" :visible.sync="Examine" width="35%">
        <div>
          <el-card :body-style="{ padding: '0px' }">
             <img :src="CoachResume.image" class="image" alt="暂无信息 请完善信息">
            <div style="padding: 14px;">
              <div>
                姓名：<span>{{ CoachResume.name }}</span>&nbsp
                性别：<span>{{CoachResume.gender ==1?"男":"女"}}</span>&nbsp
                年龄：<span>{{CoachResume.age }}</span>&nbsp
              </div>
              <div class="bottom clearfix">
                <i class="el-icon-mobile-phone"></i>手机号码：
                <span class="time">{{CoachResume.phone}}</span>
                &nbsp&nbsp&nbsp
                <i class="el-icon-s-home"></i>
                住址：{{CoachResume.address}}<br />
              </div>
              <div>
                学历：{{ CoachResume.education}}&nbsp&nbsp
                毕业院校：{{CoachResume.graduate}}<br>
                工作履历：{{CoachResume.jobResume}}<br />
              </div>
            </div>
          </el-card>
        </div>


        <el-button @click="Examine = false" type="danger" round>取 消</el-button>
      </el-dialog>







    </el-row>

  </div>
</template>

<script>
  export default {
    name: "VenueExamine",
    data() {
      return {
        CoachResume: {},
        Examine: false,
        page: {},
        param: {
          pageNum: 1,
          pageSize: 5,
        },
      }
    },
    methods: {
      //查询自己的简历
      loadCoachResume(coachId) {
        this.$http.get("account/yCoachResume/VenueLookCoachResume", {
          params: {
            coachId: coachId
          }
        }).then(resp => {
          this.CoachResume = resp.data.data;
        });
      },
      openExamine(coachId) {
        this.Examine = true;
        this.loadCoachResume(coachId);
      },
      passExamine(coachId) {
        this.$http.get("/venue/yCoachEnter/passCoachEnterVenue", {
          params: {
            coachId: coachId
          }
        }).then(resp => {
          this.$message({
            message: resp.data.msg,
            type: 'success'
          });
          this.loadAllVenueClassroom();
        });
      },
      //分页
      handleSizeChange(val) {
        this.param.pageSize = val;
        this.loadVenueExamine();
      },
      handleCurrentChange(val) {
        this.param.pageNum = val;
        this.loadVenueExamine();
      },
      //分页查询
      loadVenueExamine() {
        this.$http.get("/venue/yCoachEnter/pageCoachEnterByVenueId", {
          params: {
            pageNum: this.param.pageNum,
            pageSize: this.param.pageSize
          }
        }).then(resp => {
          this.page = resp.data.data;
        })
      }
    },
    created() {
      this.loadCoachResume();
      this.loadVenueExamine();
    }
  }
</script>

<style>
  .image {
    width: 100%;
    height: 500px;
    display: block;
  }
</style>
